package casa.depesos.app.com.http.req;


import casa.depesos.app.com.http.HttpReq;
import casa.depesos.app.com.http.Req;
import casa.depesos.app.com.http.ReqCallback;
import casa.depesos.app.com.http.bean.ExtendLinkBean;
import casa.depesos.app.com.http.parser.ExtendLinkParser;
import okhttp3.FormBody;

public class ExtendLinkReq implements HttpReq<ExtendLinkBean> {

    String id;
    int type;

    public ExtendLinkReq(int type, String id) {
        this.id = id;
        this.type = type;
    }

    @Override
    public void req(ReqCallback<ExtendLinkBean> callback) {//   0: queryRepayCode; 1: queryExtendPayCode
        FormBody.Builder builder = new FormBody.Builder();
        builder.add("lref", id);
        builder.add("aType", "1");
        String url;
        if (type == 0) {
            url = "/app/financial/retrieveRepaymentStatusCode";
        } else {
            url = "/app/financial/retrieveLoanExtensionPaymentCode";
        }
        Req.post(url, getParam(), getHeader(), builder.build(), new ExtendLinkParser(), callback, this);
    }
}
